var e = require;
var t = module;
var o = exports;
var ii, nn = this && this.__extends || (ii = function (t, e) {
    return (ii = Object.setPrototypeOf || {
        __proto__: []
    }
        instanceof Array &&
        function (t, e) {
            t.__proto__ = e
        } ||
        function (t, e) {
            for (var o in e) Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o])
        })(t, e)
},
    function (t, e) {
        function o() {
            this.constructor = t
        }
        ii(t, e),
            t.prototype = null === e ? Object.create(e) : (o.prototype = e.prototype, new o)
    }
),
    rr = this && this.__awaiter ||
        function (t, e, o, i) {
            return new (o || (o = Promise))(function (n, a) {
                function r(t) {
                    try {
                        l(i.next(t))
                    } catch (e) {
                        a(e)
                    }
                }
                function s(t) {
                    try {
                        l(i.
                            throw(t))
                    } catch (e) {
                        a(e)
                    }
                }
                function l(t) {
                    var e;
                    t.done ? n(t.value) : (e = t.value, e instanceof o ? e : new o(function (t) {
                        t(e)
                    })).then(r, s)
                }
                l((i = i.apply(t, e || [])).next())
            })
        };
var oo = (this && this.__decorate) ||
    function (e, t, a, n) {
        var i,
            o = arguments.length,
            s = o < 3 ? t : null === n ? (n = Object.getOwnPropertyDescriptor(t, a)) : n;
        if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) s = Reflect.decorate(e, t, a, n);
        else
            for (var r = e.length - 1; r >= 0; r--)
                (i = e[r]) && (s = (o < 3 ? i(s) : o > 3 ? i(t, a, s) : i(t, a)) || s);
        return o > 3 && s && Object.defineProperty(t, a, s), s;
    }; Object.defineProperty(o, "__esModule", { value: !0 });
var a = e("BaseModuleUI"),
    n = e("GlobalParams"),
    i = e("AudioManager"),
    r = e("Game"),
    s = e("AD"),
    l = cc._decorator,
    _ = l.ccclass,
    c = l.property,
    d = (function (e) {
        function t() {
            var t = (null !== e && e.apply(this, arguments)) || this;
            return (
                (t.award_hero_ske = null),
                (t.signin_view_node = null),
                (t.award_type_node = null),
                (t.seven_hero_ske = null),
                (t.award_num_label = null),
                (t.today_num_label = null),
                (t.test_btn_view = null),
                (t.three_btn = null),
                (t.over_signin_node = null),
                (t.signin_info = null),
                t
            );
        }
        return (
            nn(t, e),
            (t.prototype.initView = function () {
                e.prototype.initView.call(this), this.showSigninInfo();
            }),
            (t.prototype.OnClick = function (t) {
                var o = this;
                e.prototype.OnClick.call(this, t);
                var a = t.node.name;
                switch (a) {
                    case "get_btn":
                    case "three_btn":
                    case "three_get_btn":
                        var r = function (e) {
                            if (0 == o.signin_info.type) o.uiManager.addCoinNum(o.signin_info.num * e);
                            else if (1 == o.signin_info.type) o.uiManager.addZsNum(o.signin_info.num * e);
                            else if (2 == o.signin_info.type) o.uiManager.addSpNum(o.signin_info.num * e);
                            else if (3 == o.signin_info.type) o.uiManager.addFhbNum(o.signin_info.num * e);
                            else if (4 == o.signin_info.type) o.uiManager.addTykNum(o.signin_info.num * e);
                            else if (-1 == o.signin_info.type) {
                                var t = n.GlobalParams.playerSkinInfo.value;
                                (t.use[0] = 5),
                                    t.have_hero.push(5),
                                    (n.GlobalParams.playerSkinInfo.value = t),
                                    o.uiManager.showPopup("ObtainHeroTipView");
                            }
                            var a = n.GlobalParams.PlayerSigninInfo.value;
                            (a.signin_date = new Date().toLocaleDateString()),
                                (a.signin_num += 1),
                                (n.GlobalParams.PlayerSigninInfo.value = a),
                                o.uiManager.playerTaskOverInfo(1, 1),
                                o.showSigninInfo();
                        };
                        "three_btn" == a
                            ? s.default.getInstance().showVideo(function (e) {
                                i.default.playGameBGM(), e == s.ResultEnum.Success && r(3);
                            })
                            : r(1);
                }
            }),
            (t.prototype.showSigninInfo = function () {
                var e = n.GlobalParams.PlayerSigninInfo.value;
                e.signin_date == new Date().toLocaleDateString()
                    ? ((this.over_signin_node.active = !0), (this.test_btn_view.active = !1))
                    : ((this.over_signin_node.active = !1), (this.test_btn_view.active = !0));
                var t = e.signin_num % 7;
                if (
                    ((this.signin_info = r.default.signin_info[t]),
                        e.signin_num % 7 == 6 &&
                        0 != Math.floor(e.signin_num / 7) &&
                        (this.signin_info = r.default.signin_info[7]),
                        (this.today_num_label.string = "第" + (e.signin_num + 1) + "天"),
                        -1 == this.signin_info.type)
                )
                    (this.award_type_node.active = !1),
                        (this.award_num_label.node.active = !1),
                        (this.seven_hero_ske.node.active = !0),
                        (this.three_btn.active = !1);
                else {
                    (this.award_type_node.active = !0),
                        (this.award_num_label.node.active = !0),
                        (this.seven_hero_ske.node.active = !1),
                        (this.three_btn.active = !0);
                    for (var o = 0; o < this.award_type_node.childrenCount; o++)
                        this.award_type_node.children[o].active = o == this.signin_info.type;
                    this.award_num_label.string = "x" + this.signin_info.num;
                }
                for (o = 0; o < this.signin_view_node.childrenCount; o++) {
                    var a = this.signin_view_node.children[o];
                    (a.children[1].active = o < t), (a.children[2].active = o > t);
                }
            }),
            oo([c(sp.Skeleton)], t.prototype, "award_hero_ske", void 0),
            oo([c(cc.Node)], t.prototype, "signin_view_node", void 0),
            oo([c(cc.Node)], t.prototype, "award_type_node", void 0),
            oo([c(sp.Skeleton)], t.prototype, "seven_hero_ske", void 0),
            oo([c(cc.Label)], t.prototype, "award_num_label", void 0),
            oo([c(cc.Label)], t.prototype, "today_num_label", void 0),
            oo([c(cc.Node)], t.prototype, "test_btn_view", void 0),
            oo([c(cc.Node)], t.prototype, "three_btn", void 0),
            oo([c(cc.Node)], t.prototype, "over_signin_node", void 0),
            oo([_], t)
        );
    })(a.default);
o.default = d;
